home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windows Shareware Gold
/
Windows Shareware Gold Volume 3 Number 1 (Sherburne Knowledge Systems) (1991).iso
/
other
/
f1238
/
mboxmac.txt
< prev
next >
Wrap
Text File
|
1990-10-28
|
3KB
|
74 lines
'MessageBox
'by Jonathan Zuck
'User Friendly, Inc.
'This macro assists the WinWord BASIC programmer in the
'construction of the "MsgBox" syntax. After simple selections
'are made from a dialog box, the "MsgBox" statement is
'constructed, along with a "select Case" construct to handle
'the return codes from the function.
'To use this macro, select "Edit" from the Macro menu,
'type "MessageBox" as the name of the macro, make sure that
'"global is selected and click OK. Then copy and paste the text
'below beginning with "Begin Dialog...." into the macro and save.
'You may then wish to associate the macro with a button for easier
'use. Hope this is as usefull to you as it is to me! -=- JZ
Sub MAIN
Begin Dialog UserDialog 400, 250
Text 120, 8, 250, 10, "Message Box Definition"
OKButton 120, 220, 64, 18
CancelButton 220, 220, 64, 18
GroupBox 30, 25, 150, 110, "Buttons"
OptionGroup .Buttons
OptionButton 35, 35, 70, 18, "Ok"
OptionButton 35, 50, 150, 18, "Ok/Cancel"
OptionButton 35, 65, 150, 18, "Abort/Retry/Ignore"
OptionButton 35, 80, 150, 18, "Yes/No/Cancel"
OptionButton 35, 95, 150, 18, "Yes/No"
OptionButton 35, 110, 150, 18, "Retry/Cancel"
GroupBox 210, 25, 150, 95, "Icon"
OptionGroup .Icon
OptionButton 225, 35, 70, 18, "None"
OptionButton 225, 50, 150, 18, "Hand"
OptionButton 225, 65, 150, 18, "Question"
OptionButton 225, 80, 150, 18, "Exclamation"
OptionButton 225, 95, 150, 18, "Asterisk"
Text 30, 140, 150, 10, "&Title"
TextBox 30, 155, 340, 15, .Title
Text 30, 175, 150, 10, "&Message"
TextBox 30, 190, 340, 15, .Msg
End Dialog
Dim MType As Dialog UserDialog
Dialog MType
Quote$ = Chr$(34)
CR$ = Chr$(13)
Insert "MTitle$ = " + Quote$ + MType.Title + Quote$ + CR$
Insert "MMsg$ = " + Quote$ + MType.Msg + Quote$ + CR$
Insert "MType = " + Str$(MType.Buttons +(MType.Icon * 16)) + CR$
Insert "Button = MsgBox (MMsg$, MTitle$, MType) " + CR$
If MType.Buttons > 0 Then
Tab$ = Chr$(9)
Insert "Select Case Button" + CR$
Select Case MType.Buttons
Case 1
Insert Tab$ + "Case -1 'pressed OK" + CR$ + CR$
Insert Tab$ + "Case 0 'pressed Cancel" + CR$
Case 2
Insert Tab$ + "Case -1 'pressed Abort" + CR$ + CR$
Insert Tab$ + "Case 0 'pressed Retry" + CR$ + CR$
Insert Tab$ + "Case 1 'pressed Ignore" + CR$
Case 3, 4
Insert Tab$ + "Case -1 'pressed Yes" + CR$ + CR$
Insert Tab$ + "Case 0 'pressed No" + CR$
If MType.Buttons = 3 Then
Insert CR$
Insert Tab$ + "Case 1 'pressed Cancel" + CR$
End If
Case 5
Insert Tab$ + "Case -1 'pressed Retry" + CR$ + CR$
Insert Tab$ + "Case 0 'pressed Cancel" + CR$
End Select
Insert "end select" + CR$
End If
End Sub